﻿#pragma once
#include<QString>
#include<QOpenGLWidget>
#include<QWidget>
#include<QIODevice>
#include<QPainterPath>
#include <opencv2/opencv.hpp>
#include <QPen>
#include <QTimer>				//设置采集数据的间隔时间

class QTimer;

class Imageloader :public QOpenGLWidget
{
    Q_OBJECT
public:
	explicit Imageloader(QWidget*parent);
	~Imageloader();

	void paintEvent(QPaintEvent*e)override;						//override关键字用于重载一个虚函数
	bool load(const QString& fileName);
	bool load(const QImage&image);
	bool load(cv::Mat&srcMat);
	void clear();
	bool load(QIODevice *device, const char *format);
	bool loadFromData(const uchar *data, int len, const char *format = Q_NULLPTR);
	bool loadFromData(const QByteArray &data, const char *format = Q_NULLPTR);

private:	
	QImage image;
	//QRect displayRect;
	QPen _pen;
};
